package com.zhengb.nettydemos.chapter3.simple;

import com.alibaba.fastjson.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * 模仿远程调用
 *
 * @author zhengbo
 * @date 2019/4/2
 */
public class RemoteFunctions {

    public ResponseDTO dealWithData(DataTransRequestDTO dataTransRequestDTO) {

        Integer age = dataTransRequestDTO.getAge();
        String name = dataTransRequestDTO.getName();
        String location = dataTransRequestDTO.getLocation();

        Map<String, Object> result = new HashMap<>();

        result.put("age", age);
        result.put("name", name);
        result.put("location", location);

        ResponseDTO responseDTO = new ResponseDTO();
        responseDTO.setData(JSONObject.toJSONString(result));

        return responseDTO;
    }
}
